﻿NAMFox.ns(function() { with (NAMFox) {

name("Post Tests");
html("PostTests.html");

//////////////////////////////////////////////
// Helper Methods
//////////////////////////////////////////////

function $F(selector) {
    return $FX(selector, document);
}

function postTest(name, postId, reported, view, moderator, signature) {
    test(name, function() {
        var post = new Post($F(postId).get(0));
        var moderationStatus = post.getModerationQueueStatus();
        
        equals(moderationStatus.reported, reported, postId + (reported === ReportedStatus.Reported ? " is reported." : " is not reported."));
        equals(moderationStatus.view, view, postId + (view === ViewStatus.InView ? " is in view." : " is out of view."));
        equals(moderationStatus.moderator, moderator, postId + (moderator === ModeratorStatus.Moderator ? " is viewed by a moderator." : " is not viewed by a moderator."));
        equals(post.isSignatureDisplayed(), signature, postId + (signature ? " has a signature." : " does not have a signature."));
    });
}

//////////////////////////////////////////////
// Test Cases
//////////////////////////////////////////////

postTest("Post 1 Test", "#post1", ReportedStatus.Reported, ViewStatus.OutOfView, ModeratorStatus.Moderator, false);
postTest("Post 2 Test", "#post2", ReportedStatus.Reported, ViewStatus.InView, ModeratorStatus.Moderator, true);
postTest("Post 3 Test", "#post3", ReportedStatus.NotReported, ViewStatus.InView, ModeratorStatus.Member, true);
postTest("Post 4 Test", "#post4", ReportedStatus.Reported, ViewStatus.OutOfView, ModeratorStatus.Member, false);
postTest("Post 5 Test", "#post5", ReportedStatus.Reported, ViewStatus.InView, ModeratorStatus.Member, true);
postTest("Post 6 Test", "#post6", ReportedStatus.NotReported, ViewStatus.InView, ModeratorStatus.Member, true);

}});